<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .box {
        border: solid;
        padding: 10px;
      }
    </style>
  </head>
  <body>
    <div id="app"></div>

    <template id="t1">
      <div>
        <input type="text" v-model.lazy="username" />
        {{username}}

        <hr />
        <button @click="username='lili'">set Username</button>
      </div>
    </template>
    <script src="./vue.js"></script>
    <script>
      /*
      数据双向绑定
       1. 默认是基于input事件
      */
      const vm = new Vue({
        el: "#app",
        template: "#t1",
        data: {
          username: "jack",
        },
      });
    </script>
  </body>
</html>
